/**
 * @author Amamatthew
 * @class DragonApp.view.pub.form.FileUpload
 * @extends extend: 'Ext.form.Panel',
 *
 *  实际用例:
 *
 */
Ext.define('DragonApp.view.pub.form.FileUpload', {
    extend: 'Ext.form.Panel',
    alias: 'widget.fileupload',
    config: {
        fieldLabel: undefined,
        destUrl: undefined
    },
    bodyPadding: 10,
    frame: true,
    items: [{
        xtype: 'filefield',
        name: 'file',
        itemId: 'filefield',
        fieldLabel: 'Photo',
        labelWidth: 70,
        msgTarget: 'side',
        allowBlank: false,
        anchor: '100%',
        buttonText: '选择文件...'
    }, {
        xtype: 'container',
        items: [{
            xtype: 'image',
            alt: '图像预览',
            src: 'http://www.sencha.com/img/20110215-feat-html5.png',
            width: 184,
            height: 90,
            margin: '10 0 0 0',
            itemId: 'previewfield'
        }, {
            xtype: 'displayfield'
        }]
    }],
    buttons: [{
        text: '上传',
        itemId: 'uploadBtn',
        url: undefined,
        handler: 'onUpload'
    }],
    initComponent: function() {
        me = this;
        me.callParent(arguments);

        var filefield = me.queryById('filefield');
        filefield.setFieldLabel(this.fieldLabel);
    }
});